package com.ulook.lookplanet.data.repository;

import com.ulook.lookplanet.data.model.TComment;
import com.ulook.lookplanet.data.source.ArticleDataSource;
import com.ulook.lookplanet.ui.square.article.VCommentInfo;
import com.ulook.lookplanet.util.net.ResponseCallback;

/**
 * 描述：
 *
 * @author L1998
 * @data 2021/4/21
 */
public class ArticleRepository {

    private static volatile ArticleRepository instance;
    private ArticleDataSource dataSource;

    private ArticleRepository(ArticleDataSource dataSource){
        this.dataSource = dataSource;
    }

    public static ArticleRepository getInstance(){
        if(instance == null){
            instance = new ArticleRepository(new ArticleDataSource());
        }
        return instance;
    }

    /**
     * 获取图片
     */
    public void getPic(String artId, ResponseCallback callback){
        dataSource.getPic(artId, callback);
    }

    /**
     * 获取统计数据
     */
    public void getCount(String artId, ResponseCallback callback){
        dataSource.getCount(artId, callback);
    }

    /**
     * 评论
     */
    public void commentAction(TComment comment, ResponseCallback callback){
        dataSource.commentAction(comment, callback);
    }

    /**
     * 获取评论数据
     */
    public void getComment(String artId, int itemNum, ResponseCallback callback){
        dataSource.getComment(artId, itemNum, callback);
    }
}
